<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册</title>
<link href="${base}/templates/${config.theme}/front/static/css/passport_login.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/templates/${config.theme}/front/static/js/jquery.js"></script>
<script type="text/javascript" src="${base}/templates/${config.theme}/front/static/js/ajax.js"></script>
<style>.placeholder {color: #aaa;}
.qrtipsdiv{padding:20px 0 0 140px;height:200px;}
.qrtipsdiv h3 {
    font-size: 16px;
    font-weight: bold;
    line-height: 18px;
    margin-bottom: 24px;
    padding-left: 100px;
}
</style>
</head>
<body>
<div class="layout">
	<div class="header">
		<a href="${base}/" class="logo sprite" id="for-cascade-login-link"></a>
		<div class="bannerHeader sprite"></div>
	</div>
	<div class="content reg clear">
		<div class="regForm loginL">
			<h3>微信关注</h3>
			<p style="text-align:center"><img src="${base}/templates/${config.theme}/front/static/images/qr.jpg"  width="200" /></p>
			<p class="labels" style="text-align:center">关注微信</p>
		</div>
		<div class="regForm regFormR">
        	<h3>注 册</h3>
			<div class="regHeaderTip">
				<span class="fl">
				没有账号？请注册
				</span>
				<span class="fr f12">已注册？<a href="${base}/login" class="red hvLine">登录</a></span>
			</div>	
			<form name="regform" action="${base}/register" method="post" id="inputForm" >
				<p class="inputs">
	                <input name="username" type="text"  id="username" class="ipt" placeholder="手机号码" maxlength="11"/>
				</p>
				<p class="labels" id="usernameTips" style="color: red;"></p>
             	<p class="inputs">
	                <input name="code" type="text" id="code" maxlength="6"  class="ipt iptSmall"  placeholder="短信验证码"/>
	                <a onClick="getVerify();" href="javascript:void(0)" class="btn btnReg" id="getCode">获取短信验证码<span id="time"></span></a>
				</p>
				<p class="labels" id="codeTips" style="color: red;"></p>
	            <p class="inputs">
	                <input name="password" id="password" type="password" class="ipt" placeholder="输入密码"/>
				</p>
				<p class="labels" id="passwordTips" style="color: red;"></p>
	            <p class="inputs">
	                <input name="rePassword" id="rePassword" type="password" class="ipt" placeholder="确认密码"/>
				</p>
				<p class="labels" id="rePasswordTips" style="color: red;"></p>
	            <p class="inputs">
				</p>
				<p class="labels">
					[#if feedback??]
	            		<span style="color: red;">${feedback.content}</span>
	            	[/#if]
				</p>
				<p class="mb30">
					<a id="btnReg" href="javascript:void(0);" class="btn btnReg">注册</a>
				</p>
				<p class="inputs">
					<span class="checkbox"><i class="checked"></i> 我已阅读并接受<a href="${base}/" class="red" target="_blank">服务条款</a>。</span>
				</p>
				<p class="labels"></p>
			</form>	
		</div>
	</div>  
</div>
</body>
</html>
 <script type="text/javascript">
 $(document).ready(function() {
	 
	 $("#btnReg").on("click",function(){
		 $('#inputForm').submit();
	 });
	 
     $('#inputForm').submit(function() {
        var username=$('#username').val();
        if(username.length==0){
            $('#inputForm #usernameTips').html('请输入手机号码！');
            return false;
        }
        if(username.length!=11){
            $('#inputForm #usernameTips').html('请输入有效的手机号码！');
            return false;
        }
        var usernameReg = /^1[3|4|5|8|9|7][0-9]\d{4,8}$/;
        if(!usernameReg.test(username)){
            $('#inputForm #usernameTips').html('请输入有效的手机号码！');
            return false;
        }
        if($('#code').val()==''){
            $('#inputForm #codeTips').html('请输验证码！');
            return false;
        }
        if($('#password').val() == ''){
            $('#inputForm #passwordTips').html('请输入密码！');
            return false;
        }
        if($('#rePassword').val() != $('#password').val()){
            $('#inputForm #rePasswordTips').html('两次输入密码不一致，请重新输入！');
            return false;
        }
    }); 
 });
 var c=60;
 var t;
 var issend = false;
 var returl = '';
 function timedCount(){
     $('#getCode').html(c+"秒再次获取");
     c=c-1;
     t=setTimeout("timedCount()",1000);
     if(c==0){
         stopCount();
     }
 }
 
 function stopCount(){
     clearTimeout(t);
     $('#getCode').html('获取短信验证码');
     issend = false;
     c=60;
 }

 function getVerify(){
     if($('#username').val() == ''){
        $('#inputForm #usernameTips').html('请输入手机号！');
         return false;;
     }
     if(issend && c > 0){
         return;
     }
   //ajax
     $.ax("${base}/common/sms/send",
             {"mobile":$('#username').val(),"type":"registerMember"},'GET',null,'json',
             function(data){
            	 $("#code").val(data);
             },
             function(data){
         });
     issend = true;
     timedCount();
 }
 </script>